package com.advert.presentation.bean.advert;

import com.advert.model.advert.AdvertEntity;
import com.advert.service.advert.AdvertService;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

import java.io.Serializable;


@Name("viewAdvertDetailsBean")
@Scope(ScopeType.PAGE)
public class ViewAdvertDetailsBean implements Serializable {
    @In("AdvertService")
    private AdvertService advertService;

    private AdvertEntity advert;
    private Integer advertId;

    
    public Integer getAdvertId() {
        return advertId;
    }

    public void setAdvertId(Integer advertId) {
        this.advertId = advertId;
    }

    public AdvertEntity getAdvert() {
        if (advert == null) {
            advert = advertService.getAdvert(advertId);
        }
        return advert;
    }
}
